<?php
/**
 * oscshop2 B2C电子商务系统
 *
 * ==========================================================================
 * @link      http://www.oscshop.cn/
 * @copyright Copyright (c) 2015-2017 oscshop.cn. 
 * @license   http://www.oscshop.cn/license.html License
 * ==========================================================================
 *
 * @author    李梓钿
 *
 */
namespace osc\common\controller;
use think\Controller;
use think\Db;
abstract class ModuleInstall extends controller{
	
	protected function _initialize() {		
		
		if (!is_file(APP_PATH.'database.php')) {
			header('Location:'.request()->domain().'/install');
			die();
		}				
				
		$config =   cache('db_config_data');
		
        if(!$config){        	
            $config =   load_config();					
            cache('db_config_data',$config);
        }
		
        config($config); 
		
		define('UID',osc_service('admin','user')->is_login());

        if(!UID){  
			$this->redirect(config('admin_login_url'));
        }
		
		if(admin('username')!=config('administrator')){
		 	$this->error('请使用超级管理员账号进行操作！！');
		}
		
	}
	
	
	
	
	
	
}
